'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    const { INTEGER, STRING, DATE } = Sequelize;
    await queryInterface.createTable("sys_dict_type", {
      dict_id:{
        type: INTEGER(20),
        comment: "字典主键",
        allowNull:false,
        primaryKey: true,
        autoIncrement: true
      },
      dict_name:{
        type:STRING(100),
        comment:"字典名称",
        defaultValue:""
      },
      dict_type:{
        type:STRING(100),
        comment:"字典类型",
        defaultValue:""
      },
      status:{
        type:STRING(1),
        comment:"状态（0正常 1停用）",
        defaultValue:"0"
      },
      create_by:{
        type:STRING(64),
        comment:"创建者",
        defaultValue:""
      },
      update_by:{
        type:STRING(64),
        comment:"更新者",
        defaultValue:""
      },
      remark:{
        type:STRING(500),
        comment:"备注",
        defaultValue:""
      },
      created_at: {
        type: DATE,
        comment: "创建时间",
      },
      updated_at: {
        type: DATE,
        comment: "更新时间",
      },
      deleted_at: {
        type: DATE,
        comment: "删除时间",
      }
    })
  },

  down: async (queryInterface, Sequelize) => {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
    await queryInterface.dropTable('sys_dict_type');
  }
};
